/*
 * @Author: your name
 * @Date: 2021-06-02 10:04:10
 * @LastEditTime: 2021-06-02 10:39:34
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \遵义报名\zunyi\src\store\modules\userinfo.js
 */
import {getStorage,setStorage,removeStorage} from "utils/localStorage.js"

export default {
    namespaced:true,//命名空间
    state:{
        userInfo:getStorage("zunyi_pc_userInfo")
    },
    mutations:{
        addUserInfo(state,newUserInfo){//获取用户信息
            state.userInfo = newUserInfo
            setStorage("zunyi_pc_userInfo",state.userInfo)
        },
        updateUserInfo(state,newUserInfo){//更新用户信息
            state.userInfo = newUserInfo
            setStorage("zunyi_pc_userInfo",state.userInfo)
        },
        removeStorage(state){//删除用户信息
            state.userInfo = null
            removeStorage("zunyi_pc_userInfo")
        }
    }
}